package com.yc.baihe.beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 成功故事
 * @author tan
 */
public class Story implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private int s_num;//故事的编号
	private int boy_id;//男方编号
	private int girl_id;//女方编号 
	private String title;//故事标题
	private String small_title;//故事副标题
	private String story_content;//故事内容
	private String marriage_time;//创建故事的时间
	private String two_photo;//合影
	private String loveTab;	//爱情标签
	private String totaltick;//点赞用户编号
	private int status;//状态
	private String timefrombh; //什么时候在百合
	private String temp1;//备用
	private String temp2;//备用	//照片的张数
	

	public String getTimefrombh() {
		return timefrombh;
	}

	public void setTimefrombh(String timefrombh) {
		this.timefrombh = timefrombh;
	}

	public String getLoveTab() {
		return loveTab;
	}
	
	//爱情标签
	public List<String> getLoveTags(){
		List<String> lovelist=new ArrayList<String>();
		if(loveTab!=null){
			if(loveTab.indexOf("-")>0){
				String[] loveTabs=loveTab.split("-");
				for(String a:loveTabs){
					lovelist.add(a);
				}
			}else{
				lovelist.add(loveTab);
			}
		}
		return lovelist;
	}
	//首页的成功故事标签
	public String getLovTags_index(){
		if(loveTab!=null){
			if(loveTab.indexOf("-")>0){
				String[] photos=loveTab.split("-");
				return photos[0];
			}else{
				return loveTab;
			}
		}else{
			return "夫妻相";
		}
	}

	public void setLoveTab(String loveTab) {
		this.loveTab = loveTab;
	}

	public int getS_num() {
		return s_num;
	}

	public void setS_num(int s_num) {
		this.s_num = s_num;
	}

	public int getBoy_id() {
		return boy_id;
	}

	public void setBoy_id(int boy_id) {
		this.boy_id = boy_id;
	}

	public int getGirl_id() {
		return girl_id;
	}

	public void setGirl_id(int girl_id) {
		this.girl_id = girl_id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSmall_title() {
		return small_title;
	}

	public void setSmall_title(String small_title) {
		this.small_title = small_title;
	}

	public String getStory_content() {
		return story_content;
	}

	public void setStory_content(String story_content) {
		this.story_content = story_content;
	}

	public String getMarriage_time() {
		return marriage_time;
	}

	public void setMarriage_time(String marriage_time) {
		this.marriage_time = marriage_time;
	}

	public String getTwo_photo() {
		return two_photo;
	}
	
	//在首页显示的成功故事图像
	public String getTwo_photo_index(){
		if(two_photo!=null){
			if(two_photo.indexOf("-")>0){
				String[] photos=two_photo.split("-");
				return photos[0];
			}else{
				return "<img src='"+two_photo+"'/>";
			}
		}else{
			return "<img src='story/e.png' />";
		}
	}
	
	//在成功故事空间里显示的图片组
	public List<String> getTwo_photos(){
		List<String> photos=new ArrayList<String>();
		if(two_photo.indexOf("-")>0){
			String[] photoss =two_photo.split("-");
			for(String a:photoss){
				photos.add(a.trim());
			}
			return photos;
		}else{
			photos.add(two_photo.trim());
			return photos;
		}
	}
	
	public void setTwo_photo(String two_photo) {
		this.two_photo = two_photo;
	}

	public String getTotaltick() {
		return totaltick;
	}
	
	//点赞的次数
	public int getTotalticks(){
		if(totaltick.indexOf(",")>0){
			String[] totalticks=totaltick.split(",");
			return totalticks.length;
		}else if(totaltick==null && "".equals(totaltick)){
			return 0;
		}else{
			return 1;
		}
	}

	public void setTotaltick(String totaltick) {
		this.totaltick = totaltick;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getTemp1() {
		return temp1;
	}

	public void setTemp1(String temp1) {
		this.temp1 = temp1;
	}

	public String getTemp2() {
		return temp2;
	}

	public void setTemp2(String temp2) {
		this.temp2 = temp2;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + boy_id;
		result = prime * result + girl_id;
		result = prime * result + ((loveTab == null) ? 0 : loveTab.hashCode());
		result = prime * result
				+ ((marriage_time == null) ? 0 : marriage_time.hashCode());
		result = prime * result + s_num;
		result = prime * result
				+ ((small_title == null) ? 0 : small_title.hashCode());
		result = prime * result + status;
		result = prime * result
				+ ((story_content == null) ? 0 : story_content.hashCode());
		result = prime * result + ((temp1 == null) ? 0 : temp1.hashCode());
		result = prime * result + ((temp2 == null) ? 0 : temp2.hashCode());
		result = prime * result
				+ ((timefrombh == null) ? 0 : timefrombh.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result
				+ ((totaltick == null) ? 0 : totaltick.hashCode());
		result = prime * result
				+ ((two_photo == null) ? 0 : two_photo.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Story other = (Story) obj;
		if (boy_id != other.boy_id)
			return false;
		if (girl_id != other.girl_id)
			return false;
		if (loveTab == null) {
			if (other.loveTab != null)
				return false;
		} else if (!loveTab.equals(other.loveTab))
			return false;
		if (marriage_time == null) {
			if (other.marriage_time != null)
				return false;
		} else if (!marriage_time.equals(other.marriage_time))
			return false;
		if (s_num != other.s_num)
			return false;
		if (small_title == null) {
			if (other.small_title != null)
				return false;
		} else if (!small_title.equals(other.small_title))
			return false;
		if (status != other.status)
			return false;
		if (story_content == null) {
			if (other.story_content != null)
				return false;
		} else if (!story_content.equals(other.story_content))
			return false;
		if (temp1 == null) {
			if (other.temp1 != null)
				return false;
		} else if (!temp1.equals(other.temp1))
			return false;
		if (temp2 == null) {
			if (other.temp2 != null)
				return false;
		} else if (!temp2.equals(other.temp2))
			return false;
		if (timefrombh == null) {
			if (other.timefrombh != null)
				return false;
		} else if (!timefrombh.equals(other.timefrombh))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (totaltick == null) {
			if (other.totaltick != null)
				return false;
		} else if (!totaltick.equals(other.totaltick))
			return false;
		if (two_photo == null) {
			if (other.two_photo != null)
				return false;
		} else if (!two_photo.equals(other.two_photo))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Story [s_num=" + s_num + ", boy_id=" + boy_id + ", girl_id="
				+ girl_id + ", title=" + title + ", small_title=" + small_title
				+ ", story_content=" + story_content + ", marriage_time="
				+ marriage_time + ", two_photo=" + two_photo + ", loveTab="
				+ loveTab + ", totaltick=" + totaltick + ", status=" + status
				+ ", timefrombh=" + timefrombh + ", temp1=" + temp1
				+ ", temp2=" + temp2 + "]";
	}

	public Story(int s_num, int boy_id, int girl_id, String title,
			String small_title, String story_content, String marriage_time,
			String two_photo, String loveTab, String totaltick, int status,
			String timefrombh, String temp1, String temp2) {
		super();
		this.s_num = s_num;
		this.boy_id = boy_id;
		this.girl_id = girl_id;
		this.title = title;
		this.small_title = small_title;
		this.story_content = story_content;
		this.marriage_time = marriage_time;
		this.two_photo = two_photo;
		this.loveTab = loveTab;
		this.totaltick = totaltick;
		this.status = status;
		this.timefrombh = timefrombh;
		this.temp1 = temp1;
		this.temp2 = temp2;
	}

	public Story() {
		super();
	}


	
}
